/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 * @flow
 */

import React, { Component } from 'react';
import {
    AppRegistry,
    StyleSheet,
    Text,
    View,
    Image,
    Dimensions,
    TouchableOpacity,
    Platform,
    Linking
} from 'react-native';
import NavigationBar from '../components/NavigationBar';
import ImageWrapper from '../components/ImageWrapper';
const {height, width} = Dimensions.get('window');
export default class GuanYuPeiTa extends Component {
   render() {
        return (
            <View style={styles.container}>
                <NavigationBar 
                    titleText="关于陪它"
                    leftStyle={{tintColor:"#fff"}}
                    rightStyle={{tintColor:"#fff",marginRight:15}}
                    leftIcon = 'left'
                    leftPress={()=>this.goBack()}/>
                <View style={{width:width,flexDirection:'row',alignItems:'center',justifyContent:'center',}}>
                    <ImageWrapper style={{width:80,height:80,marginTop:40,}} icon={'logo'}/>
                </View>
                <View style={{width:width,flexDirection:'row',alignItems:'center',justifyContent:'center',}}>
                    <Text style={{marginTop:20,marginBottom:30,}} >当前版本：V1.0.0</Text>
                </View>
                <TouchableOpacity onPress={()=>this.callUs()}>
                    <View style={styles.ming}>
                        <Text>商务合作电话</Text>
                        <Text>400-902-7011</Text>
                    </View>
                </TouchableOpacity>
            </View>
        );
    }
    goBack(){
        this.props.navigation.goBack();
    }
    callUs() {
        Linking.canOpenURL('tel:400-902-7011').then(supported => {
            if (!supported) {
                console.log('Can\'t handle url: ' + 'tel:400-902-7011');
            } else {
                return Linking.openURL('tel:400-902-7011');
            }
        }).catch((err) => console.log('An error occurred', err));
    }

}

const styles = StyleSheet.create({
    container:{
        ...Platform.select({
            ios: {
                marginTop: 20
            },
            android: {
                marginTop:0
            },
        }),
    },
    ming:{
        width: width,
        height: 50,
        backgroundColor:"#fff",
        flexDirection:"row",
        justifyContent:"space-between",
        borderBottomWidth:1,
        borderColor:"#eee",
        paddingLeft:14,
        paddingRight:14,
        alignItems:"center",
    }
});

